//
//  DownloadOperation.h
//  nsurlsession
//
//  Created by lk on 16/4/18.
//  Copyright © 2016年 lk. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef void(^DownloadProgressBlock)(CGFloat progress, long long totalMBRead, long long totalMBExpectedToRead);
typedef void(^DownloadSuccessBlock)(NSString *sucDownPath,NSString *SucDownName);
typedef void(^DownloadFailureBlock)(NSError *error,NSString *errorDownPath,NSString *errorDowName);
typedef void(^PhoneLastCount)(NSString *lastCount);
typedef void(^NetBreakBlock)();
typedef void(^PauseFinishBlock)();
typedef void(^RestartFinishBlock)();
typedef void(^DeletFinishBlock)();
typedef void(^AllstopComplete)();
typedef void(^AllstartComplete)();
typedef void(^ExitSuccess)();
typedef void(^AllDeleteSuccess)();
@interface LCDownloadManager : NSObject
@property(nonatomic,assign)float progress;
//多用户时唯一标示符(建议使用user_id)
@property(nonatomic,copy)NSString *userflag;
//存储空间名（例：图片：picture）
@property(nonatomic,copy)NSString *storagePath;
//
+(instancetype)getInstanceWithuserflag:(NSString *)userflag withStoragePath:(NSString *)storagePath;
//开始下载 第一个参数传链接
-(void)downloadFileWith:(NSMutableArray *)urlArray withNameArr:(NSMutableArray*)nameArray progressbloack:(DownloadProgressBlock)progressBlock successBlock:(DownloadSuccessBlock)successBlock failureBlock:(DownloadFailureBlock)failureBlock;

//暂停某一个下载
-(void)pauseTaskWithLocalPath:(NSString *)localPath WithPauseFinishBolck:(PauseFinishBlock)pausefinishBolck;
//继续下载
-(void)resumeTask;
//获取下载信息
-(NSDictionary *)getMessageWithCachePath:(NSString *)cachePath;
//判断某一个链接是否在下载
-(BOOL)isNowDownForDownPath;
//获取当前下载的链接
-(NSString *)getContenDownloadPath;
//获取当前下载状态
-(void)getdownloadWithProgressbloack:(DownloadProgressBlock)progressBlock successBlock:(DownloadSuccessBlock)successBlock failureBlock:(DownloadFailureBlock)failureBlock netBreakBlock:(NetBreakBlock)netBreakBlock;
//删除全部
-(void)deleteAll:(AllDeleteSuccess)alldeletsuccess;
//判断某一个视频是否正在下载／等待
-(BOOL)isNowDownForDownPath:(NSString *)localPath;
//重新开始某个任务
-(void)restartTaskWithLocalPath:(NSString *)localPath restartFinishBlock:(RestartFinishBlock)restartfinishBlock;
//全部暂停
-(void)allStopWithStopBlock:(AllstopComplete)allstopcomplete;
//全部开始
-(void)allStartWithStartBlock:(AllstartComplete)allstartcomplete;
//删除多个任务
-(void)deletDownloadTaskwith:(NSMutableArray *)urlArr WithNameArr:(NSMutableArray *)nameArr WithUserFlag:(NSString *)userflag withDeletfinshBlock:(DeletFinishBlock)deletfishBlock;
//多用户退出切换
-(void)exitTheprogramwithExitsuccessblock:(ExitSuccess)exitsuccess;
-(void)gainLastCount:(PhoneLastCount)lastCount;
@end
